<html>
<?php include("../../MerchandiseBay/conn.php"); ?>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>

<?
//upload pic start
//$target_path are variable
$target_path = 'productpic/';
$regProduct=$category=$_REQUEST['regProduct'];
echo $regProduct;
$target_path = $target_path .$regProduct.".jpg"; 

if(($_FILES['image']['name'])!="")
 {
 if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {
    
} else{
   echo "There was an error uploading the file, please try again!";
}
}
//upload pic end

$category=$_REQUEST['category'];
$kind=$_REQUEST['kind'];
$regProduct=$_REQUEST['regProduct'];
$entered_date=$_REQUEST['entereddate'];
$price=$_REQUEST['price'];
$comment=$_REQUEST['comment'];
$imagename=$regProduct.".jpg";


if($_FILES['image']['name']=="")
   {$imagename="blank.jpg";}
   
   
$sqlInsert="insert into merchandise(regno,category,kind,price,comment,entered_date,pic)
            values('$regProduct','$category','$kind','$price','$comment','$entered_date','$imagename')";
$qryInsert=mysql_query($sqlInsert,$conn);

?>
</head>

<body>

<div align="center">
	
  <table width="99%" height="413" border="0" align="left" bgcolor="#F7F7F7" id="table1">
    <tr> 
      <td colspan="2" background="images/blueBG.gif" height="43"><div align="left"><font color="#0000FF" size="4" face="Verdana"> 
          <strong>ADD PRODUCT SUCCESSFULL </strong></font> </div></td>
    </tr>
    <tr> 
      <td align="right" width="24%"><div align="right"><b><font size="2" face="Verdana">&nbsp;Code 
      Product :</font></b></div></td>
      <td align="left" width="76%"><font size="2" face="Verdana">&nbsp;
        <?=$regProduct?>
        </font></td>
    </tr>
    <tr> 
      <td align="right" width="24%"><b><font size="2" face="Verdana">Category 
        :</font></b></td>
      <td align="left" width="76%"><font size="2" face="Verdana">&nbsp; 
        <?=$category?>
        </font></td>
    </tr>
    <tr> 
      <td align="right" width="24%"><b><font size="2" face="Verdana">Kind :</font></b></td>
      <td align="left" width="76%"><font size="2" face="Verdana">&nbsp; 
        <?=$kind?>
        </font></td>
    </tr>
    <tr> 
      <td align="right" width="24%"><b><font size="2" face="Verdana">Price :</font></b></td>
      <td align="left" width="76%"><font size="2" face="Verdana">&nbsp;
        <?=$price?>
        </font></td>
    </tr>
    <tr> 
      <td align="right" width="24%"><b><font size="2" face="Verdana">Comment :</font></b></td>
      <td align="left" width="76%"><font size="2" face="Verdana">&nbsp;
        <?=$comment?>
        </font></td>
    </tr>
    <tr> 
      <td align="right" width="24%"><b><font size="2" face="Verdana">Date :</font></b></td>
      <td align="left" width="76%"><font size="2" face="Verdana"> &nbsp;
        <?=$entered_date?>
        </font></td>
    </tr>
    <tr> 
      <td align="right" width="24%"><b><font size="2" face="Verdana">Pic :</font></b></td>
      <td align="left" width="76%"> <font size="2" face="Verdana"> <img src="productpic/<?=$imagename?>" alt="<?=$imagename?>" border="1" hspace="7" vspace="2"></a></font></td>
    </tr>
    <tr> 
      <td align="right" colspan="2"> <p align="center"><font face="Verdana"><a href="productForm.php">Add Product</a> | <a href="adminHome.php">Home</a></font></td>
    </tr>
  </table>
</div>

</body>

</html>